package com.apexedu.eas.entity;

import com.apexedu.util.StringUtil;

import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.List;

/**
 * 考试信息
 * Created with IntelliJ IDEA.
 * User: jiangfeng
 * Date: 13-11-12
 * Time: 上午11:28
 * 考试安排信息表
 */
@javax.persistence.Table(name = "TJX_KSXX")
@Entity
public class TjxKsxx {
	private Long id;
    private Long ksfa;//排考方案
	private Long xq;  //学期
	private Long kc;  //课程
	private String kch;  //课程号
	private String ksmc; //考试名称
	private Long jxb; //教学班
    private Long bj;//班级
	private Long ksrq;//考试日期
	private Long kssj; //考试时间[TJX_KSSJ]
    private String kskssj;//考试开始时间
	private String ksjssj;//考试结束时间
	private Integer kssc; //考试时长
	private Integer ksrs; //考试人数
	private Integer ctzt; //冲突状态
	private String ctms;  //冲突描述
	private Integer hbKsxz;//考试性质【代码集子项】
	private Integer hbKsfs;//考试方式【代码集子项】
	private String ksfslx; //考试方式类型
	private Integer sftj;  //是否提交
	private Integer sfypk; //是否已排考

	/**
	 * 教学班名称
	 */
	private String jxbmc;

	/**
	 * 考场信息
	 */
	private List<TjxKsxxKcxx> listKcxx = new ArrayList<TjxKsxxKcxx>(); //考场信息

	@javax.persistence.Column(name = "ID")
	@Id
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@javax.persistence.Column(name = "XQ")
	@Basic
	public Long getXq() {
		return xq;
	}

	public void setXq(Long xq) {
		this.xq = xq;
	}

	@javax.persistence.Column(name = "KC")
	@Basic
	public Long getKc() {
		return kc;
	}

	public void setKc(Long kc) {
		this.kc = kc;
	}

	@javax.persistence.Column(name = "KCH")
	@Basic
	public String getKch() {
		return kch;
	}

	public void setKch(String kch) {
		this.kch = kch;
	}

	@javax.persistence.Column(name = "KSMC")
	@Basic
	public String getKsmc() {
		return ksmc;
	}

	public void setKsmc(String ksmc) {
		this.ksmc = ksmc;
	}

	@javax.persistence.Column(name = "JXB")
	@Basic
	public Long getJxb() {
		return jxb;
	}

	public void setJxb(Long jxb) {
		this.jxb = jxb;
	}

	@javax.persistence.Column(name = "KSRQ")
	@Basic
	public Long getKsrq() {
		return ksrq;
	}

	public void setKsrq(Long ksrq) {
		this.ksrq = ksrq;
	}

	@javax.persistence.Column(name = "KSSJ")
	@Basic
	public Long getKssj() {
		return kssj;
	}

	public void setKssj(Long kssj) {
		this.kssj = kssj;
	}

	@javax.persistence.Column(name = "KSJSSJ")
	@Basic
	public String getKsjssj() {
		return ksjssj;
	}

	public void setKsjssj(String ksjssj) {
		this.ksjssj = ksjssj;
	}

	@javax.persistence.Column(name = "KSSC")
	@Basic
	public Integer getKssc() {
		return kssc;
	}

	public void setKssc(Integer kssc) {
		this.kssc = kssc;
	}

	@javax.persistence.Column(name = "KSRS")
	@Basic
	public Integer getKsrs() {
		return ksrs;
	}

	public void setKsrs(Integer ksrs) {
		this.ksrs = ksrs;
	}

	@javax.persistence.Column(name = "CTZT")
	@Basic
	public Integer getCtzt() {
		return ctzt;
	}

	public void setCtzt(Integer ctzt) {
		this.ctzt = ctzt;
	}

	@javax.persistence.Column(name = "CTMS")
	@Basic
	public String getCtms() {
		return ctms;
	}

	public void setCtms(String ctms) {
		this.ctms = ctms;
	}

	@javax.persistence.Column(name = "HB_KSXZ")
	@Basic
	public Integer getHbKsxz() {
		return hbKsxz;
	}

	public void setHbKsxz(Integer hbKsxz) {
		this.hbKsxz = hbKsxz;
	}

	@javax.persistence.Column(name = "HB_KSFS")
	@Basic
	public Integer getHbKsfs() {
		return hbKsfs;
	}

	public void setHbKsfs(Integer hbKsfs) {
		this.hbKsfs = hbKsfs;
	}

	@javax.persistence.Column(name = "KSFSLX")
	@Basic
	public String getKsfslx() {
		return ksfslx;
	}

	public void setKsfslx(String ksfslx) {
		this.ksfslx = ksfslx;
	}

	@javax.persistence.Column(name = "SFTJ")
	@Basic
	public Integer getSftj() {
		return sftj;
	}

	public void setSftj(Integer sftj) {
		this.sftj = sftj;
	}

	@javax.persistence.Column(name = "SFYPK")
	@Basic
	public Integer getSfypk() {
		return sfypk;
	}

	public void setSfypk(Integer sfypk) {
		this.sfypk = sfypk;
	}

    @javax.persistence.Column(name = "KSFA")
    @Basic
    public Long getKsfa() {
        return ksfa;
    }

    public void setKsfa(Long ksfa) {
        this.ksfa = ksfa;
    }

    @javax.persistence.Column(name = "BJ")
    @Basic
    public Long getBj() {
        return bj;
    }

    public void setBj(Long bj) {
        this.bj = bj;
    }

    @javax.persistence.Column(name = "KSKSSJ")
    @Basic
    public String getKskssj() {
        return kskssj;
    }

    public void setKskssj(String kskssj) {
        this.kskssj = kskssj;
    }

	@Transient
	public List<TjxKsxxKcxx> getListKcxx() {
		return listKcxx;
	}

	@Transient
	public void setListKcxx(List<TjxKsxxKcxx> listKcxx) {
		this.listKcxx = listKcxx;
	}

	@Transient
	public String getRq() {
		if (ksrq != null && ksrq != 0) {
			return ksrq.toString().substring(0, 4) + "-" + ksrq.toString().substring(4, 6) + "-" + ksrq.toString().substring(6);
		}
		return "";
	}

	@Transient
	public void setRq(String rq) {
		if (StringUtil.isNotBlank(rq))
			this.ksrq = Long.parseLong(rq.replaceAll("-", ""));
	}

	/**
	 * 考场信息数
	 *
	 * @return
	 */
	@Transient
	public int getKcxxSize() {
		return listKcxx.isEmpty() ? 1 : listKcxx.size();
	}

	/**
	 * 第一条考场信息
	 *
	 * @return
	 */
	@Transient
	public TjxKsxxKcxx getKcxx0() {
		return listKcxx.isEmpty() ? new TjxKsxxKcxx() : listKcxx.get(0);
	}

	@Transient
	public String getJxbmc() {
		return jxbmc;
	}

	@Transient
	public void setJxbmc(String jxbmc) {
		this.jxbmc = jxbmc;
	}
}
